<?php
namespace App\Admin\Logic;

use App\Models\SwtGood;

class GoodsLogic extends BaseLogic {


   public static function editGoods($info, $sku_id)
   {
       $goods_info = SwtGood::firstWhere(['sku_id' => $sku_id]);

       if($goods_info) {
           SwtGood::where('sku_id', $sku_id) -> update($info);
           $id = $goods_info -> id;
       } else {
           $info['sku_id'] = $sku_id;
           $id = SwtGood::insertGetId($info);
       }

       return $id;
   }
}
